<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\api\logic;

use app\common\logic\LogicBase;
use \tpfcore\Core;
use think\Validate;

class Slide extends ApiBase
{
    public function get_List($data = [])
    {
        $limit = isset($data['limit']) && !empty($data['limit']) ? (int)$data['limit'] : 3;
        $sign = isset($data['sign']) && !empty($data['sign'])?$data['sign']:"mini_home_banner";

        $cids = \think\Db::name('SlideCat')->where('sign', $sign)->column('id');
        $where = ['status' => 1, 'cid' => ['in', $cids]];
        $list = Core::loadModel($this->name)->getList(
            [
                'where' => $where,
                'field' => ['status', 'content'],//数组方式传入为排除
                'order' => 'sort asc',
                'paginate' => ['rows' => $limit, 'config' => ['query' => request()->param()]],
            ]
        );

        return [0, 'success', $list];
    }
}